<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    332. Reconstruct Itinerary
   </h1>
   <p>
    Given a list of airline tickets represented by pairs of departure and arrival airports
    <code>
     [from, to]
    </code>
    , reconstruct the itinerary in order. All of the tickets belong to a man who departs from
    <code>
     JFK
    </code>
    . Thus, the itinerary must begin with
    <code>
     JFK
    </code>
    .
   </p>
   <p>
    <b>
     Note:
    </b>
   </p>
   <ol>
    <li>
     If there are multiple valid itineraries, you should return the itinerary that has the smallest lexical order when read as a single string. For example, the itinerary
     <code>
      ["JFK", "LGA"]
     </code>
     has a smaller lexical order than
     <code>
      ["JFK", "LGB"]
     </code>
     .
    </li>
    <li>
     All airports are represented by three capital letters (IATA code).
    </li>
    <li>
     You may assume all tickets form at least one valid itinerary.
    </li>
   </ol>
   <p>
    <b>
     Example 1:
    </b>
   </p>
   <pre>
<code><strong>Input: </strong></code><code>[["MUC", "LHR"], ["JFK", "MUC"], ["SFO", "SJC"], ["LHR", "SFO"]]</code>
<strong>Output: </strong><code>["JFK", "MUC", "LHR", "SFO", "SJC"]</code>
</pre>
   <p>
    <b>
     Example 2:
    </b>
   </p>
   <pre>
<code><strong>Input: </strong></code><code>[["JFK","SFO"],["JFK","ATL"],["SFO","ATL"],["ATL","JFK"],["ATL","SFO"]]</code>
<strong>Output: </strong><code>["JFK","ATL","JFK","SFO","ATL","SFO"]</code>
<strong>Explanation: </strong>Another possible reconstruction is <code>["JFK","SFO","ATL","JFK","ATL","SFO"]</code>.
&nbsp;            But it is larger in lexical order.
</pre>
  </div>
  <div>
   <h1 class="question_title">
    332. 重新安排行程
   </h1>
   <p>
    给定一个机票的字符串二维数组
    <code>
     [from, to]
    </code>
    ，子数组中的两个成员分别表示飞机出发和降落的机场地点，对该行程进行重新规划排序。所有这些机票都属于一个从JFK（肯尼迪国际机场）出发的先生，所以该行程必须从 JFK 出发。
   </p>
   <p>
    <strong>
     说明:
    </strong>
   </p>
   <ol>
    <li>
     如果存在多种有效的行程，你可以按字符自然排序返回最小的行程组合。例如，行程 ["JFK", "LGA"] 与 ["JFK", "LGB"] 相比就更小，排序更靠前
    </li>
    <li>
     所有的机场都用三个大写字母表示（机场代码）。
    </li>
    <li>
     假定所有机票至少存在一种合理的行程。
    </li>
   </ol>
   <p>
    <strong>
     示例 1:
    </strong>
   </p>
   <pre><code><strong>输入: </strong></code><code>[["MUC", "LHR"], ["JFK", "MUC"], ["SFO", "SJC"], ["LHR", "SFO"]]</code>
<strong>输出: </strong><code>["JFK", "MUC", "LHR", "SFO", "SJC"]</code>
</pre>
   <p>
    <strong>
     示例 2:
    </strong>
   </p>
   <pre><code><strong>输入: </strong></code><code>[["JFK","SFO"],["JFK","ATL"],["SFO","ATL"],["ATL","JFK"],["ATL","SFO"]]</code>
<strong>输出: </strong><code>["JFK","ATL","JFK","SFO","ATL","SFO"]</code>
<strong>解释: </strong>另一种有效的行程是&nbsp;<code>["JFK","SFO","ATL","JFK","ATL","SFO"]</code>。但是它自然排序更大更靠后。</pre>
  </div>
 </body>
</html>